Recognition method, corresponding system and computer program product

ABSTRACT

A neural network classifies an input signal. For example, an accelerometer signal may be classified to detect human activity. In a first convolutional layer, two-valued weights are applied to the input signal. In a first two-valued function layer coupled at input to an output of the first convolutional layer, a two-valued function is applied. In a second convolutional layer coupled at input to an output of the first two-valued functional layer, weights of the second convolutional layer are applied. In a fully-connected layer coupled at input to an output of the second convolutional layer, two-valued weights of the fully connected layer are applied. In a second two-valued function layer coupled at input to an output of the fully connected layer, a two-valued function of the second two-valued function layer is applied. A classifier classifies the input signal based on an output signal of second two-valued function layer.

BACKGROUND Technical Field

The description relates to signal processing methods.

One or more embodiments may apply, for instance, to the recognition ofhuman activity.

Description of the Related Art

Multi-axial accelerometers for integration in a package, possiblytogether with a gyroscope, are currently produced in massive quantities.

Prevailing trends in that area are directed towards bringing ArtificialIntelligence (A.I.) capabilities into sensors, while ensuring ultra-lowpower sensing (e.g., in the microWatt range) with aggressive areashrinking (e.g., 68%), which will facilitate improving return on netassets (RONA) and meeting increased price pressures.

Improvements are thus desirable, possibly by resorting to A.I. “close tothe sensor,” as A.I. is centralized today on powerful remote cloudservers. Intelligence means, e.g., the capability for a system toself-learn and self-adapt to time-varying real sensed physicalphenomena.

Shifting part of the intelligence from the cloud into sensors may thusrepresent a goal to pursue, and the capability of integrating, e.g.,deep-learning neural networks may contribute in providing technologicaladded value to sensor products and their applications while alsomitigating excessive workloads concentrated into servers and excessiveraw data rates on the communication networks between sensors andservers.

BRIEF SUMMARY

In an embodiment, a method, comprises: applying, in a firstconvolutional layer of a neural network, two-valued weights of the firstconvolutional layer to an input signal of the first convolutional layer;applying, in a first two-valued function layer of the neural networkcoupled at input to an output of the first convolutional layer, atwo-valued function of the first two-valued function layer; applying, ina second convolutional layer of the neural network coupled at input toan output of the first two-valued functional layer, weights of thesecond convolutional layer; applying, in a fully-connected layer of theneural network coupled at input to an output of the second convolutionallayer, two-valued weights of the fully connected layer; applying, in asecond two-valued function layer of the neural network coupled at inputto an output of the fully connected layer, a two-valued function of thesecond two-valued function layer; and classifying, using a classifier ofthe neural network coupled at input to an output of the secondtwo-valued function layer, the input signal based on an output signal ofsecond two-valued function layer. In an embodiment, the methodcomprises: applying, using a normalization layer of the neural networkcoupled between the first convolutional layer and the first two-valuedfunction layer, normalization to an output signal of the firstconvolutional layer. In an embodiment, the method comprises: applying,using a normalization layer of the neural network coupled between thefully-connected layer and the second two-valued function layer,normalization to an output signal of the fully-connected layer. In anembodiment, the applying two-valued weights in the first convolutionallayer comprises applying a set of filters to the input signal,generating respective filtered output signals. In an embodiment, theapplying weights in the second convolutional layer comprises applying aset of filters to the signal from the first neural network processingand the method comprises, in the second convolutional layer, addingtogether outputs from the filters in the set of filters, generatingrespective single values. In an embodiment, the method comprises:applying, using a max pooling layer coupled between the secondconvolutional layer and the fully-connected layer, max pooling to anoutput of the second convolutional layer. In an embodiment, theclassifying comprises applying softmax classification. In an embodiment,the method comprises: applying pre-neural network processing to anacceleration signal, generating the input signal of the firstconvolutional layer, the pre-neural network processing includingfiltering to separate a dynamic acceleration component from a gravitycomponent of the acceleration signal. In an embodiment, the filtering toseparate the dynamic acceleration component from the gravity componentcomprises one of infinite impulse response filtering or exponentialmoving averaging. In an embodiment, the pre-neural network processingincludes: applying a gravitational rotation to the filtered accelerationsignal. In an embodiment, the method comprises: applying post-neuralnetwork processing to an output of the classifier, the post-neuralnetwork processing including at least one of: temporal filtering toremove mis-classification errors; and heuristic filtering. In anembodiment, the weights of the second convolutional layer are two-valuedweights.

In an embodiment, a device comprises: a first convolutional layer of aneural network, which, in operation, applies two-valued weights of thefirst convolutional layer; a first two-valued function layer of theneural network coupled at input to an output of the first convolutionallayer, wherein the first two-valued function layer, in operation,applies a two-valued function of the first two-valued function layer; asecond convolutional layer of the neural network coupled at input to anoutput of the first two-valued functional layer, wherein the secondconvolutional layer in operation, applies weights of the secondconvolutional layer; a fully-connected layer of the neural networkcoupled at input to an output of the second convolutional layer, whereinthe fully connected layer, in operation, applies two-valued weights ofthe fully connected layer; a second two-valued function layer of theneural network coupled at input to an output of the fully connectedlayer, wherein the second two-valued function layer, in operation,applies a two-valued function of the second two-valued function layer;and a classifier of the neural network coupled at input to an output ofthe second two-valued function layer, wherein the classifier, inoperation, classifies an input signal to the first convolutional layerbased on an output signal of second two-valued function layer. In anembodiment, the device comprises: a normalization layer of the neuralnetwork coupled between the first convolutional layer and the firsttwo-valued function layer, wherein the normalization layer, inoperation, normalizes an output signal of the first convolutional layer.In an embodiment, the device comprises: a second normalization layer ofthe neural network coupled between the fully-connected layer and thesecond two-valued function layer, wherein the second normalizationlayer, in operation, normalizes an output signal of the fully-connectedlayer. In an embodiment, the first convolutional layer comprises a setof filters, which, in operation, generate respective filtered signals.In an embodiment, the second convolutional layer comprises a set offilters coupled to an adder. In an embodiment, the device comprises: amax pooling layer coupled between the second convolutional layer and thefully-connected layer.

In an embodiment, a system comprises: an input; and digital signalprocessing circuitry, coupled to the input, wherein the digital signalprocessing circuitry, in operation, implements a neural networkcomprising: a first convolutional layer which, in operation, appliestwo-valued weights to the input signal; a first two-valued functionlayer, which, in operation, applies a first two-valued function to anoutput of the first convolutional layer; a second convolutional layer,which, in operation, applies weights to an output of the firsttwo-valued function layer; a fully-connected layer coupled to the secondconvolutional layer, which, in operation, applies two-valued weights toan input of the fully connected layer; a second two-valued functionlayer, which, in operation, applies a two-valued function to an outputof the fully connected layer; and a classifier, which, in operation,classifies a signal received by the input based on an output signal ofsecond two-valued function layer. In an embodiment, the digital signalprocessing circuitry, in operation: normalizes the output of the firstconvolutional layer provided to the first two-valued function layer;adds components of an output of the second convolutional layer,generating the input to the fully-connected layer; and normalizes theoutput of the fully-connected layer provided to the second two-valuedfunction layer. In an embodiment, the system comprises: pre-neuralnetwork processing circuitry coupled to the input, the pre-neuralnetwork processing circuitry including a filter and a gravitationalrotator. In an embodiment, the system comprises: post-neural networkprocessing circuitry coupled to the input, the post-neural networkprocessing circuitry including a temporal filter and a heuristic filter.In an embodiment, the system comprises an accelerometer. In anembodiment, the system comprises: a gyroscope. In an embodiment, thesystem comprises a chip including the digital signal processingcircuitry and the accelerometer.

In an embodiment, a non-transitory computer-readable medium has contentswhich configure digital signal processing circuitry to implement aneural network, the neural network comprising: a first convolutionallayer which, in operation, applies two-valued weights to an inputsignal; a first two-valued function layer coupled at input to an outputof the first convolutional layer, and which, in operation, applies afirst two-valued function; a second convolutional layer coupled at inputto an output of the first two-valued function layer, and which, inoperation, applies weights; a fully-connected layer coupled at input toan output of the second convolutional layer, and which, in operation,applies two-valued weights; a second two-valued function layer coupledat input to an output of the fully connected layer, and which, inoperation, applies a two-valued function; and a classifier, which, inoperation, classifies the input signal based on an output of secondtwo-valued function layer. In an embodiment, the contents comprisesinstructions executed by the digital signal processing circuitry. In anembodiment, the instructions, when executed by the digital signalprocessing circuitry, cause the digital signal processing circuitry tofilter the input signal provided to the first convolutional layer.

One or more embodiments may comprise a computer program product loadablein the memory of at least one processing circuit (e.g., a computer) andcomprising software code portions for executing the steps of the methodwhen the product is run on at least one processing circuit. As usedherein, reference to such a computer program product is understood asbeing equivalent to reference to a computer-readable medium containinginstructions for controlling the processing system in order toco-ordinate implementation of the method according to one or moreembodiments. Reference to “at least one computer” is intended tohighlight the possibility for one or more embodiments to be implementedin modular and/or distributed form.

One or more embodiments may provide a hybrid binary neural networkcircuit suited for performing, e.g., accelerometer activityclassification.

In one or more embodiments, weights can be two-valued, e.g., either +1or −1 (or possibly other pairs of values such as 0, 1), while theachievement of high accuracy is facilitated by enumerating with fewvalues (possibly quantizing into a lower number of bits than floatingpoint precision) neuron activations only in certain sections of thenetwork.

A network according to embodiments can be trained in a supervisedfashion, possibly by resorting to open-source training tools, with toolssuch as Keras, Lasagne, Tensorflow, CNTK, Caffe and the likerepresenting cases in point.

A neural network circuit according to embodiments can receiveaccelerometer signals from a measuring device and identify via aclassifier a corresponding activity being performed, e.g., by a wearerof the device.

In one or more embodiments, such a network can accommodate processing ofcombined accelerometer and gyroscope input.

One or more embodiments may facilitate achieving high accuracy inrecognizing numerous classes, with complexity and power consumptionreduced to a level possibly well below the level of the sensor itself.

Features of embodiments may comprise a scalable number of neurons andimproved neuron inner architecture, which admits software implementationby means of microprocessors and/or DSPs with very low power consumption,possibly with dedicated hardware accelerators and/or specificinstructions to accelerate execution of the layers and neurons comprisedin the network itself.

One or more embodiments may facilitate providing artificial neuralnetworks combining (very) low power consumption with the capability ofclassifying adequately human activities as sampled via an accelerometerand optionally a gyroscope.

Possible fields of application of corresponding (e.g., sensor) systemsmay comprise mobile communications, the automotive sector, robotics,various industrial and agricultural applications, wearable devices,safety-critical infrastructure monitoring and Internet-of-Thingsdomains.

One or more embodiments permit customers/users to train neural networkson which open source training tools are installed and run and thendeploy neural networks circuits in (ultra) low power (e.g., fraction ofalways-on sensors.

One or more embodiments may facilitate avoiding the possible sharing ofproprietary customer data during the learning phases of neural networkson both high power consumption (e.g., ×86) computers and GPUs.

One or more embodiments may demonstrate accuracy levels (evaluated onthe basis of average recall) in the range of at least 97.5% on fiveclasses of human activity, with complexity (conservatively) evaluated at25Kops per second @16 Hz with an input window shifted by 16 samplesacquired by the sensors; this figure may be further lowered by about ⅓to a power consumption of about 0.5 μW in an active low-power mode witha minimum power supply of 1.62 V, well below the power consumption ofthe (already low-power) sensor itself.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

One or more embodiments will now be described, by way of example onlywith reference to the annexed figures, wherein:

FIG. 1 is a block diagram exemplary of a MultiLayer Perceptron (MLP)neural network,

FIG. 2 is a block diagram exemplary of a convolutional neural network(ConvNet),

FIG. 3 is a block diagram exemplary of a pipeline as possibly used inembodiments,

FIGS. 4 to 6 are block diagrams exemplary of possible details ofembodiments of a convolutional neural network,

FIG. 7 is an exemplary block diagram of a system according toembodiments,

FIG. 8 is a block diagram exemplary of a possible arrangement of circuitblocks in embodiments, and

FIG. 9 is an exemplary block diagram of a system according toembodiments.

DETAILED DESCRIPTION

In the ensuing description, one or more specific details areillustrated, aimed at providing an in-depth understanding of examples ofembodiments of this description. The embodiments may be obtained withoutone or more of the specific details, or with other methods, components,materials, etc. In other cases, known structures, materials, oroperations are not illustrated or described in detail so that certainaspects of embodiments will not be obscured.

Reference to “an embodiment” or “one embodiment” in the framework of thepresent description is intended to indicate that a particularconfiguration, structure, or characteristic described in relation to theembodiment is comprised in at least one embodiment. Hence, phrases suchas “in an embodiment” or “in one embodiment” that may be present in oneor more points of the present description do not necessarily refer toone and the same embodiment. Moreover, particular conformations,structures, or characteristics may be combined in any adequate way inone or more embodiments.

The references used herein are provided merely for convenience and hencedo not define the extent of protection or the scope of the embodiments.

A neural network can be defined a two-valued one if both weights andactivations are constrained to be enumerated with 2 numbers, e.g, either+1 or −1 at run and training time (during which parameter gradients arecomputed). This approach can drastically reduce memory size andassociated accesses, with most arithmetic operations replaced withnarrow bit-wise operations.

In the literature, an early example of such a neural network can befound in Courbariaux, M. et al.: “Binaryconnect: Training deep neuralnetworks with binary weights during propagation,” Advances in NeuralInformation Processing System, 2015.

There, a neural network is discussed where binarized weights are usedduring both training and testing phases.

An example of a fully binary network (weights and activations) isprovided by the Binarized Neural Network (BNN) also proposed byCourbariaux, M. et al. in: “Binarized neural networks: Training deepneural networks with weights and activations constrained to +1 or −1.”arXiv preprint arXiv: 1602.02830 (2016).

In their experiments, Courbariaux et al. refer to a MultiLayerPerceptron (MLP) network as exemplified in FIG. 1 and comprising:

-   -   a fully connected (FC) block 10 comprising a fully connected        input layer 11 receiving an input x, followed by a normalization        layer 12,    -   a fully connected block 13 repeated N times (xN),    -   another fully connected layer 14 followed by a normalization        layer 15 providing an output y.

The crosses in FIG. 1 are representative of the result of binarizationof activations.

As is well known in computational networks, the activation function(out=f(in)) of a node defines the output of that node given an input orset of inputs. In artificial neural networks this function is alsocalled the transfer function (out=f(in)).

The FC (Fully Connected) block 13 is repeated a number of times N equalto the number of hidden layers in the network, e.g., N=3.

Courbariaux et al. also refer to a Convolutional Network (ConvNet) asexemplified in FIG. 2 and comprising:

-   -   a first convolutional block 20, in turn comprising an input        convolutional layer 201 receiving an input x, followed by a        cascaded arrangement of a normalization layer 202 (with a cross        representing the binarization of activations), a convolutional        layer 203, a max pooling layer 204 and a normalization layer        205, with another cross represents the binarization of        activations,    -   two further convolutional blocks 21 and 22, each one followed by        a cross representing the binarization of activations, and    -   a classification block 23, in turn comprising a fully connected        layer 231 followed by a cascaded arrangement of a normalization        layer 232 (with a cross to represent the binarization of        activations), a fully connected layer 233, a normalization layer        234 (with a cross to represent the binarization of activations),        a fully connected layer 235 and a normalization layer 236        providing an output y.

The convolutional block structure may differ for the number of filtersapplied in the convolutional layer.

Courbariaux et al. trained the network of FIG. 1 on the MNIST dataset ofhandwritten digits (as available at http://yann.lecun.com/exdb/mnist/)and the network of FIG. 2 on CIFAR-10 (see, e.g.,https://www.cs.toronto.edu/˜kriz/cifar.html) with 10 image classes andSVHN (Street View House Numbers—see, e.g.,http://ufldl.stanford.edu/housenumbers/) image datasets.

Test error rates documented with comparable network architectures are0.94% on the MNIST image dataset (see, e.g., Goodfellow, Ian J. et al.:“Maxout Networks”, arXiv preprint arXiv: 1302.4389 (2013)), 1.69% onSVHN images (see, e.g., Lin, Min et al.: “Network in network”, arXivpreprint arXiv: 1312.4400 (2013)) and 7.62% on CIFAR-10 images (see,e.g., Lee, Chen-Yu et al. “Generalizing pooling functions inconvolutional neural networks: Mixed, gated, and tree”, Internationalconference on artificial intelligence and statistic. 2016).

It is noted that Courbariaux et al. achieved results very close to thosecited by way of comparison: 0.96% on MNIST images, 2.53% on SVHN imagesand 10.15% on CIFAR-10 images.

The type of networks proposed by Courbariaux et al. may thus facilitatedecreasing complexity and memory by paying a price in terms of accuracy,e.g., up to 10.15% on CIFAR-10 images.

It is otherwise noted that satisfactory results obtained in experimentsin image classification and with benchmark datasets may translate intoinadequate performance of the same procedures if applied to humanactivity recognition (briefly, HAR) that processes data acquired by anaccelerometer and not by an imager, because of the very different natureof the input data (accelerations vs pixels).

As discussed in the following, if applied to recognizing a datasetcomposed by classes of different human activities (HAR) sampled withaccelerometer data, pipelines as depicted in FIGS. 1 and 2 may providelevels of accuracy that are (very far) below desirable values of 95% andhigher which are instead desirable for HAR applications.

One or more embodiments may address the HAR accuracy problem by means ofa pipeline comprising a neural pipeline which may integrate two-valuedlayers, normalization layers and max pooling layers in a sort of hybridarrangement which may distinguish over prior arrangements, for example,as follows:

-   -   one or more embodiments may go beyond conventional arrangements        comprising, e.g., two convolutional layers and two fully        connected layers, with less memory required to hold parameters        and less computational complexity;    -   weights may be constrained to be two-valued (enumerated by 2        numbers) e.g., either +1 or −1, while, in order to facilitate        achieving a desired accuracy, activations are two-valued only        where desirable, e.g., in some complex layers where they        facilitate reducing execution time and lead to a simpler        hardware implementation. Moreover, activations may also be        enumerated with two values in some layers to help achieving a        desired accuracy and lower complexity, while avoiding to apply        two-value enumeration for all network activations in any        arbitrary manner.

One or more embodiments may thus provide a hybrid neural network (HNN)in a pipeline which may comprise also pre-processing and post-processingphases.

One or more embodiments may provide a procedure aimed at human activityrecognition or HAR where input data (signal x) are acquired from anaccelerometer A (plus possibly a gyroscope G), as visible, e.g., inFIGS. 7 and 9.

FIG. 3 is exemplary of a corresponding pipeline circuit 100, suited tobe implemented as discussed in the following and comprising:

-   -   a pre-processing section or circuit comprising a filter 101        (e.g., an infinite impulse response—IIR filter or an exponential        moving average—EMA to separate a dynamic acceleration component        from gravity) and a gravity rotation—GR block or circuit 102        configured for rotating the output signal from the filter 101,        e.g., in order to have gravity always on a same axis;    -   a classification stage 103 based, e.g., on a hybrid neural        network circuit as discussed in the following;    -   a post-processing section or circuit comprising a temporal        filter 104 to remove possible errors due to mis-classification        and a post-temporal filter 105 (e.g., a heuristic filter) to        correct systematic errors of predictions and/or correct        transitions between classes.

Certain possible embodiments of the circuit blocks 101 to 105 in FIG. 3will now be discussed by way of example.

In one or more embodiments, the filter 101 may comprise a (e.g., IIR)low-pass filter (e.g., of order 4) which separates the fast changingdynamic acceleration component (α) from a slowly changing gravitycomponent (g).

As an alternative to such filtering, in order to remove the g component(so that the average is zero), an exponential moving average—EMA can beused, e.g.:

ĝt=αχ _(i)+(1−α)ĝ _(t-1)

The associated coefficient can be defined experimentally so that forsmall values it may identify the average component (g acceleration).Therefore

{circumflex over (x)}_(t) =x _(t) −ĝ _(t):

so that such a filter shall behave as a high pass filter.

The gravity rotation block 102 may facilitate having g always orientedtoward the bottom vertical side (conventionally defined as direction −z)e.g., by means of the Rodrigues rotation formula—see, e.g.,https://en.wikipedia.org/wiki/Rodrigues %27_rotation formula—aligningz-axis to gravity:

$ = {{\frac{}{}\mspace{14mu} \sin \; \theta} = {{1 - {\frac{1}{_{2}^{2}}\mspace{14mu} \cos \mspace{14mu} \theta}} = {{{- _{z}}\mspace{14mu} v} = {{\left\lbrack {{- _{y}},_{x},0} \right\rbrack \mspace{14mu} v} = \frac{v}{v}}}}}$a^(′) = a  cos   θ + (v × a)  sin   θ + v ⋅ a(1 − cos  θ)

where θ represents the rotation angle and ν the rotation axis.

The (e.g., acceleration) signal obtained by pre-processing (at 101 and102) the signal x and input to the neural network circuit 103 isindicated as AS.

Turning now for brevity to the elements downstream of the neural networkcircuit 103, the post-processing performed on the output signal OS fromthe neural network circuit 103 may comprise different approaches offiltering, e.g., in a temporal filter 104.

A simple approach for 104 is a voting filter, where a class which occursmore frequently in a temporal window is selected. If the temporal windowis T steps long and n is the number of predictions for class k, theselected class will be:

$c = {\max\limits_{k}n_{k}}$

Various known prediction models return probabilities for each classwhich represent how likely the prediction is to be true. A more accurateapproach is to average all the probabilities over the window and findonly at that point the most likely class at the time t:

${c(t)} = {\max\limits_{k}{\sum\limits_{s = 1}^{T}\; {p_{k}\left( {t - s} \right)}}}$

The average may be implemented more efficiently by using an exponentialaverage:

{circumflex over (p)} _(k)(t)=αp _(k)(t)+(1−α){circumflex over (p)}_(k)(t−1)

where {circumflex over (p)} is the currently estimated average and α isa coefficient representing the “inverse effective window length”, e.g.,if α=0.1 the average will roughly depend on the last 10 predictionsamples. The value of α can also be adapted on the likelihood of thelast prediction, using larger values for more confident predictions andsmaller values for less confident predictions. In that case, α is anincreasing function of the most likely prediction, that is:

${a(t)} = {f\left( {\max\limits_{k}{p_{k}(t)}} \right)}$

Such temporal filters work satisfactorily if the class does not changeover a large temporal period, allowing the errors to average out, butmay increase latency and introduce prediction errors near classtransitions.

A different procedure may be used to independently estimate when a HARregime change has occurred, e.g., by estimating an autoregressive movingaverage model (ARMA—see, e.g.,https://en.wikipedia.org/wiki/Autoregressive % E2%80%93moving-average_model) on short “stretches” of data, which can be assumedto come from signals belonging to a same class, and checking when thepredictions exceed a given threshold:

ŷ(t)=α₁ y(t−1)+ . . . +α_(p) y(t−p)|ŷ(t)−y(t)|>thr

Alternatively, as the classifier will be less confident around HARtransitions, changes may be detected by searching short intervals wherethe filtered probabilities are all below a given threshold.

Once the changes have been detected, the temporal filters are aligned tothe changes, e.g., by setting the value of Tin order to fit the temporalwindow on homogeneous prediction signals.

Alternatively, one or more embodiments may adopt post-processing asexemplified, e.g., in U.S. patent application Ser. No. 15/280,463 towhich European Patent Application No. 17193073.8 corresponds(essentially a median filtering, based on finite state automata—FSA).

While capable of removing transient errors as caused by noise orincorrect predictions, a temporal filter 104 as discussed may not haveadequate knowledge about the problem and may not correct systematicestimation errors, such as a class predicted with much higherprobability than others, because this introduces errors in the mean.

In order to reduce errors, one or more embodiments may adopt a heuristicfilter as indicated at 105 in FIG. 3.

While such a heuristic filter can be applied to the raw predictions fromthe classifier 103, if cascaded to (“downstream”) a temporal filter as104 and after alignment on transition boundaries it may facilitateobtaining higher accuracy.

For instance, the transitions between one class (e.g., source such asjogging) and another (e.g., destination such as walking) may beconfirmed only after a given number of predictions of the destinationclass over a temporal window have been found with the predictions overthe maximum time interval over all the pairs stored in a queue.

The size of the temporal window and the number of confirmations maydepend on the pair of classes (source, destination). For transitionswhich are deemed exceedingly unlikely or impossible (e.g., as revealedby post processing FSA, with, e.g., changing from source such as bikingto destination such as driving in human activity recognition being acase in point) the number of confirmations required may be set toinfinity.

In a simplified version, the map of window sizes and confirmation maydepend only on the destination class.

In one or more embodiments, a heuristic filter 105 may exploit the factthat potential estimation errors may be known at training time from theconfusion matrix, which shows for each pair of (predicted, ground truth)classes the percentage of predictions; ideally, a perfect classifier hasa diagonal confusion matrix with all values equal to 1, while the othervalues equal to 0.

Given an interval between two detected changes, the filter may estimatethe distribution of predictions over the interval, e.g., by counting theoccurrences or by estimating the parameters of a multinomialdistribution over the predictions. The mis-classification pairs(predicted, ground truth) that are known to occur from the confusionmatrix and that have a probability higher than a threshold can becorrected by replacing the predicted class with the estimated groundtruth class.

In one or more embodiments, the output from the filters 104, 105 may bea classification C₁ C₂ . . . C_(N) (corrected over the classificationproduced at 103) identifying a wearer's activity (e.g., stationary,walking, running, biking, driving) as a function of the input signal xas provided, e.g., from an accelerometer plus possibly a gyroscope andsubjected to neural network processing in the network 103.

In one or more embodiments, the hybrid neural network (HNN) circuit 103of FIG. 3 may comprise plural circuit stages or sections comprising twoconvolutional layers and two fully connected layers as depictedcollectively in FIGS. 4, 5 and 6, with the circuit blocks in FIG. 5assumed to follow those in FIG. 4 and the circuit blocks in FIG. 6assumed to follow those in FIG. 5.

In the following description of possible exemplary embodiments, various“multi-valued” entities will be discussed, namely entities that canassume plural values, e.g., two, three, and so on, virtually any(positive) integer value. Certain entities (e.g.,signals/weights/activations) will be expressly referred to as“two-valued” entities insofar as, in one or more embodiments, theselatter entities may be intended to assume only two values (e.g., +1 or−1, +1 or 0, and so on), that is, may have a range of possible valueslimited to two values.

In FIG. 4 an example of a first section 103A of the network 103 is showncomprising a convolutional layer 1031 (receiving the components of theacceleration signal AS from the blocks 101 and 102 in FIG. 3), anormalization layer 1032 and a two-valued function/circuit 1033 whichproduces, starting from an Nbit signal, a 1 bit signal providing atwo-valued signal to the stage or section 103B discussed in thefollowing.

The acceleration signal AS supplied to the convolutional layer 1031comprises, e.g., a three-dimensional time-varying signal measured with atri-axial accelerometer, divided into windows of fixed length. Each axisof the input signal is processed separately.

The convolutional layer 1031 applies a set of C filters (each onerepresents a channel) with length k on the signal and returns Cdifferent outputs AS×M, equal in number to the filters, which are passedon to the normalization block 1032. There, a mean (average) value, e.g.,as computed during the neural network training phase, is subtracted fromeach sample. The mean values calculated are equal in number to thechannels C.

The circuit block 1033 in the first stage 103A comprises a two-valued(e.g., Nbits >>>1 bit) function 1033 that returns as an output the signof the input, e.g., +1 or −1.

The circuit block 1033 exemplified in FIG. 4 takes into account the factthat the input signal AS to the convolutional layer 1031 will not beenumerated with two values (e.g., will not be necessarily +1 or −1) andrather comprise multi-valued integers (e.g., enumerated with 16-bit orany other type of signal bit depth, such as 12-bit or 14-bit, dependingon the implementation of the accelerometer output data bit-depth).

The presence of two-value enumerated weights in the layer 1031 may leadto appreciable savings in memory footprint (e.g., 32-bits or 64-bitsfloating point for the GPU implementation used to train the neuralnetwork, or 16-bit fixed point, for a possible hardwired implementationof the neural network, down to 1 bit per each weight) and memoryreads/writes because costly floating and fixed point multiplications arereplaced with simpler sign changes of the input.

This also facilitates hardware implementations without multipliers,which are a major source of complexity, and considering the area forimplementing a multiplier (e.g., one third of the total area in a lowpower reduced instruction set DSP processor), silicon area costs aresignificantly reduced as well as power consumption.

In one or more embodiments, the second section 103B (FIG. 5) in thenetwork 103 comprises a convolutional layer comprising plural filters1034 (from 1 to C, C being a number of channels therein) which isfollowed by a max pooling layer 1040 (as discussed in the following).

FIG. 5 exemplifies the behavior of the second convolutional layer in thesection 103B for the i-th sample. As noted, this layer comprises C(different) filters 1034, each in turn comprising a set ofone-dimensional filters of length k. The one-dimensional filter outputsare added together as indicated at 1034 a, this resulting in respectivesingle values y₁, y₂, . . . , y_(C) forwarded to the max pooling layer1040 and on to the stage 103C in FIG. 6, with both the input and theoutput of the max pooling layer 1040 being multi-valued, that is capableof assuming more than two values.

In one or more embodiments, weights in the second section 103B areenumerated with two-values, so that, e.g., 16-bit fixed pointmultiply-accumulations can be replaced with 1-bit XNOR-bitcountoperations, thereby substantially reducing the associated hardwarecomplexity and offering the opportunity to exploit parallelization.

Also, the two-valued enumeration of the activations to the convolutionallayer 1034 was found to have an appreciable impact on the second stage103B where most operations (approximately 60%) are performed.

In one or more embodiments, the structure of the third section 103C(1035, 1036, 1037 and 1038 as exemplified in FIG. 6) in the network 103is to some extent similar to the structure of the first section 103A.

In comparison to the first circuit section 103A, the convolutional layeris replaced in the third circuit section 103C of FIG. 6 by a fullyconnected layer 1035. The fully connected layer 1035, which receives the(multi-valued) output signal from the max pooling layer 1040, comprisesa (fixed) number of units or neurons, each one computing the sameoperations.

The operations carried out by the units in the layer 1035 can besummarized by the following equation:

$y_{u} = {\sum\limits_{i}{\sum\limits_{j}{\sum\limits_{k}{x_{ijk}W_{ijk}}}}}$

where x_(ijk) represents the input sample organized in athree-dimensional matrix, i, j and k represent the indices of the sampleelements, W_(ijk) represents the corresponding (two-valued) weights andy_(u) represents the output of a single unit, working in parallel withthe others, of the fully connected layer.

Even though the weights applied are two-value enumerated, the parametersfor use in this stage may take most of the memory size (e.g., about 80%)insofar as each neuron embodies a number of parameters equal to theinput signal values.

The output of the layer 1035 is a vector with a length equal to thenumber of units considered, which is supplied to a normalization layer1036 (e.g., again subtracting a mean value as discussed previously forthe layer 1032 in the first section 103A) followed by a two-valuedfunction/circuit 1037 which produces, starting from an Nbit signal, a 1bit, two-valued signal.

It will be otherwise appreciated that, while not mandatory, thenormalization blocks 1032, 1036 may be helpful, e.g., in terms ofdynamic of the network nodes.

A classifier 1038, such as, for instance, a SoftMax classifier (see,e.g., https://en.wikipedia.org/wiki/Softmax_function), as the last stageof the third section 103C may then produce, from the two-valued outputof the circuit 1037, an output signal OS to be supplied to the errorremoval/correction filters 104 and 105.

In one or more embodiments, in this section input activations may not beenumerated with two-values.

The input to the classifier (e.g., SoftMax) layer 1038, in the caseexemplified, is the output vector of the previous stage 1037, thereforeeach unit in this layer implements an equation of the type:

${P\left( {y = {jx}} \right)} = \frac{e^{x^{T}w_{j}}}{\sum\limits_{k = 1}^{K}\; e^{x^{T}w_{k}}}$

That is the predicted probability for the j-th class given a sampleinput vector x (that is the output of 1037) and a weighting vector w,learnt during an (e.g., off-line) training phase, and where the index Krepresents the number of inputs.

The (multi-valued) output OS from this last stage 1038 represents, e.g.,the probability of the input signal x (on the left of FIG. 3) belongingto a certain output class, therefore the number of units of the SoftMaxlayer corresponds to the number of output classes. The units of thislayer hold in memory less parameters than the other layers and requireless operations.

A hybrid neural network as exemplified herein has demonstrated theability of detecting five human activities with high precision, using asmall number of operations and limited memory. Accuracy is illustratedthrough confusion matrices.

Table 1 reports measured results on an in-house created dataset DB(Dataset version 1.6) which stores 3 axial accelerations at 16 Hz as aresult of several human activities, manually annotated to generate theground truth association between input signals x (FIG. 3, left hand) andoutput classes C (FIG. 3, right hand).

TABLE 1 Confusion matrix obtained with hybrid neural network with No. offilters = 8; Fully connected units FC 1 = 64; max Pooling = (4, 1);Average Recall = 97.513 Predicted Predicted Predicted PredictedPredicted Stationary Walking Running Biking Driving Stationary 98.3830.000 0.000 0.013 1.617 Walking 0.000 99.280 0.411 0.309 0.000 Running0.000 2.531 97.175 0.220 0.073 Biking 2.538 0.887 0.000 94.924 1.651Driving 0.000 0.000 0.000 2.199 97.801

Tables 2 and 3 below reports the confusion matrices of Courbariaux's MLPand ConvNet, respectively.

TABLE 2 Confusion matrix obtained for Courbariaux's MLP Model on Dataset1.6. Average recall = 54.826% Predicted Predicted Predicted PredictedPredicted Stationary Walking Running Biking Driving Stationary 98.2170.000 0.000 0.000 1.783 Walking 0.000 100.000 0.000 0.000 0.000 Running0.000 99.725 0.000 0.202 0.073 Biking 1.322 55.693 0.000 33.739 9.247Driving 57.218 0.000 0.000 0.610 42.173

TABLE 3 Confusion matrix obtained for Courbariaux's ConvNet Model onDataset 1.6. Average recall = 76.270% Predicted Predicted PredictedPredicted Predicted Stationary Walking Running Biking Driving Stationary99.414 0.000 0.420 0.000 0.166 Walking 0.000 12.944 87.056 0.000 0.000Running 0.018 1.119 98.844 0.000 0.018 Biking 2.423 0.559 9.025 87.1510.843 Driving 11.713 0.000 3.832 1.459 82.996

Table 4 below provides some data on the complexity of a hybrid neuralnetwork according to embodiments.

TABLE 4 Complexity data Parameters Parallel Layer [bytes] Operations perwindow* Op. Conv 1 (8 × 5)/8 = 5 5 × (20 × 3 × 20 × 3 × 8 1031 8) = 2400ADD Norm 1 Mean: (8 × 16)/ (20 × 3 × 8) = 20 × 3 × 8 1032 8 = 16 480 SUBConv 2 (8 × 8 × 5)/ 5 × 8 × (16 × 3 × 16 × 3 × 8 1034 8 = 40 8) = 15360ADD Max / 3 × (4 × 3 × 8) =  4 × 3 × 8 pool layer 576 SUB + COMP 1040 FC1st (8 × 4 × 3 × 64 × (4 × 3 × 8) = 64 stage 64)/8 = 768 6144 ADD 1035Norm 2 Mean: (64 × 16)/ 64 SUB 64 1036 8 = 128 FC 2 (64 × 5)/ 64 × 5 =320 ADD  5 SoftMax 8 = 40 1038 TOT 997 25344 / (*)per second @16 Hz ifwindow is shifted by 16 samples)

As shown in Table 4, only 1 Kbyte of parameters may be stored in memoryand about 25,000 operations (sums and subtractions) are carried out,assuming 3-axial acceleration acquired at 16 Hz.

The rightmost column in Table 4 also reports the notional innerparallelism available for each layer of the hybrid neural network 103.

The average accuracy obtained was 97.513%, while the (best) validationerror was 5.98%.

By way of comparison, accuracy measured using the Courbariaux models was54.826 and 76.27%, while the validation error rate does not fall below16%. Therefore, even if all multiply-accumulations are replaced with1-bit XNOR-count operations, thus reducing complexity, the accuracy ofthe state of the art algorithms (Courbariaux's MLP and ConvNet) islargely lower than the accuracy which may be achieved with one or moreembodiments.

It is otherwise noted that a digital implementation of one or moreembodiments is advantageous, as this will be adapted to run, e.g., at 25kHz or lower by exploiting the inner parallelism of each layer.

Table 5 summarizes further differences between a hybrid neural network(HNN) according to embodiments and Courbariaux's MLP and ConvNetpipeline stages.

A first difference is that one or more embodiments do not requirereplication of a well-defined group of layers as is the case ofconventional solutions such as MLP and ConvNet.

Another difference is that one or more embodiments as exemplified hereindo not involve batch normalization after max pooling and an enumerationwith two-values before a fully connected layer.

Still another difference lies in the ability of one or more embodimentsof benefitting from both pre-processing (e.g., the input filter 101 andthe gravity rotation 102) and post-processing (e.g., the temporal filter104, suited for processing acceleration, while Courbariaux's MLP andConvNet (discussed previously) are conceived for image processing andnot for processing acceleration signals: therefore they are applied topixels do not deal with gravity-related pre-processing as implemented,e.g., in stages 101 and 102.

Furthermore, one or more embodiments can use a SoftMax classificationlayer with weights each one enumerated with two values.

TABLE 5 differences between embodiments (HNN) and MLP and ConvNetpipeline stages. Courbariaux MLP Courbariaux ConvNet HNN 54.8% 76.3%97.5% FC Conv IIr or EMA - 101 BN BN GR - 102 B (FC, BN and B repeated Ntimes) B Conv - 1031 FC Conv N - 1032 BN MP TVE - 1033 EMA = Exponentialmoving average BN Conv - 1034 IIR = Infinite Impulse Response B (Conv,BN, B, Conv, MP, BN, MP - 1040 B repeated 3 times) GR = Gravity rotationFC FC - 1035 TVE = Two-value enumeration BN N - 1036 (N bits >>> 1 bit)B (FC, BN, B repeated 2 times) TVE - 1037 BN = Batch Normalization FCSM - 1038 N = Normalization BN TF - 104 MP = Max Pooling HF - 105 FC =Fully Connected Conv = Convolutional SM = SoftMax TF = Temporal FilterHF = Heuristic Filter

One or more embodiments may significantly reduce the set of possibleoutput values.

For instance, in the case of the SoftMax layer 1038 at the end of thenetwork, the number of distinct values is (n_inputs x n_outputs x 2),where, e.g., n_input=128 is the number of hidden binary states andn_outputs=5 is the number of recognized classes.

A discretization of output values is thus indicative of the possibleactivation and weight enumeration with two-values according toembodiments. Also, two-valued enumeration patterns (e.g., +1/−1) applied(by way of testing) as an input (AS) may correspondingly restrict thenumber of distinct values processed in the first convolutional layer(e.g., 1031) and affect the statistics of activations in (all)subsequent layers.

One or more embodiments may feature a range of a few kHz, a low memoryfootprint (e.g., 1 KB) which, associated with multiplier-less circuits,enables a (very) low-frequency implementation as depicted in FIG. 7 atsystem in package type of chip.

FIG. 7 exemplifies the possibility of integrating an accelerometer A 702and an (optional) gyroscope G 704 in a same package CP together with anassociated pipeline 100—comprising a hybrid neural network 100 (e.g.,all the blocks in FIG. 3) as exemplified herein—for processing thesignals produced thereby.

For example, the accelerometer A may produce samples of three-axisacceleration at a certain frequency (e.g., 16 Hz) that feed the pipeline100, whose output is an index C₁ C₂ C_(N) to a class of recognized humanactivity (e.g., walking, running, biking etc.).

The pipeline 100 can be implemented on a digital signal processoraccording to a general layout as exemplified in FIG. 8.

The following designations may apply to the blocks illustrated in FIG.8:

-   -   2000: program counter    -   2002: instruction cache    -   2004: instruction fetch unit    -   2006: instruction decode    -   2008: address generation    -   2010: arithmetic logic unit    -   2012: register file    -   2014: single instruction multiple data two-valued operations    -   2016: load/store unit    -   2018: co-processor interface    -   2020: arithmetic floating point unit    -   2022: bus interface    -   2024: data memory

A processor as exemplified in FIG. 8 features logic to implementparallel two-valued operations using the single instruction multiple(two-valued) data instruction set (e.g., 2014).

A coprocessor floating point unit (see, e.g., the interface 2018) canoptionally accelerate pre- and post-processing operations (for example,101, 102 in FIG. 3) that benefit from such a precision while operatingat the same data-rate (for example 16 Hz) as the accelerometer sensoroutput data-rate.

A typical power dissipation figure of such a digital signal processor(e.g., as in the STRED™ family of processors available with the assigneecompany) can be as low as 20 μW per MHz with 90 nm technology (eembcbenchmark see, e.g., http://www.eembc.org/)

A non-parallelized implementation at 25 kHz may involve a powerconsumption of about 0.5 μW. A pipeline spreading intermediatecalculations, in a parallel implementation, for each input accelerationsample may turn out to be (at least) ⅓ less complex (e.g., 16 kHz) whilea ×2 parallel implementation can be operated at about 8 kHz, if not evenlower. This corresponds to power consumption figures at least threetimes lower (conservatively) than the one achieved by current sensorsolutions such as LIS2DW12 (e.g., 1.1 μA (ODR=12.5 Hz) in activelow-power mode with a minimum power supply of 1.62 V) available with theassignee company.

This facilitates producing ultra-low-power high-performance three-axis(linear) A.I. accelerometers.

While FIG. 7 exemplifies a possible integration in a same package CP ofthe accelerometer A/gyroscope G with the associated processing pipeline100, one or more embodiments as exemplified in FIG. 9 may comprise theaccelerometer A 902/gyroscope G 904 integrated in a first chip packageCP1 together with an output stage OS for providing acceleration signalsα_(x), α_(y), α_(z) (possibly with associated gyroscopic signals g_(x),g_(y), g_(z)) to a second chip package CP2 where the pipeline 100 isimplemented in a DSP with an associated microcontroller unit—MCU such asa STM32 processor as available with the assignee company.

The following designations may apply to the blocks illustrated in FIG.9:

-   -   300: digital signal processor—DSP    -   302: host central processing unit—CPU    -   304: on-chip memory (e.g., RAM, ROM, FLASH)    -   306: memory controller    -   308: off-chip RAM memory    -   310: memory controller    -   312: off-chip ROM/FLASH memory.

An approach as exemplified in FIG. 9 may facilitate discharging the MCUfrom a low frequency task that might cause the MCU (actually designed torun at much higher frequencies, such as tens or hundreds of MHz) to bekept in an active mode running at a minimum (for example 2) MHz rate,rather than being switched to a deep sleep mode, while the neuralnetwork pipeline is executed by the DSP, further reducing the powerconsumption of the system.

In one or more embodiments, a method may comprise:

-   -   receiving an input signal (e.g., AS, possibly obtained by        pre-processing a “raw” signal x) and applying (artificial)        neural network processing (e.g., 103) to the input signal to        produce an output signal (e.g., OS) therefrom, wherein the        neural network processing comprises:    -   first neural network processing (e.g., 103A) comprising first        convolutional layer processing (e.g., 1031), wherein two-valued        weights are applied to the input signal, and (possibly after        normalization at 1032) a two-valued function (e.g., 1033) to        produce a two-valued signal from the result of the first        convolutional layer processing,    -   second neural network processing (e.g., 103B) comprising further        convolutional layer processing (e.g., 1034) applied to the        two-valued signal from the first neural network processing with        two-valued weights and (two-valued) activations, and    -   third neural network processing (e.g., 103C) comprising fully        connected layer processing (e.g., 1035), wherein two-valued        weights are applied to the signal from the second neural network        processing, and (possibly after normalization at 1036) a        respective two-valued function (e.g., 1037) to produce a        two-valued signal from the result of the fully connected layer        processing, and classifier processing (e.g., 1038) to produce        said output signal from the two-valued signal from the        respective two-valued function.

One or more embodiments may comprise applying normalization (e.g., at1032 and/or 1036) to:

-   -   the output from the first convolutional layer processing fed to        the two-valued function in the first neural network processing,        and/or    -   the output from the fully connected layer processing fed to the        respective two-valued function in the third neural network        processing.

In one or more embodiments, the first convolutional layer processing inthe first neural network processing may comprise applying a set offilters to the input signal and returning respective filtered outputs(e.g., AS×M).

In one or more embodiments, the second convolutional layer processing inthe second neural network processing may comprises applying a set offilters to the signal from the first neural network processing andadding together (e.g., 1034 a) the outputs from the filters in the setof filters to provide respective single values (e.g., y₁, y₂, y_(C)) forprocessing in the third neural network processing.

In one or more embodiments, the second neural network processing maycomprise max pooling processing (e.g., 1040) of the result of the secondconvolutional layer processing.

In one or more embodiments, classifier processing in the third neuralnetwork processing may comprise softmax classifier processing.

One or more embodiments may comprise applying neural network processingto an input signal pre-processed by at least one of:

-   -   filtering (e.g., 101) to separate a dynamic acceleration        component from gravity, and/or    -   gravity rotation (e.g., 102).

In one or more embodiments, filtering to separate a dynamic accelerationcomponent from gravity may comprise one of infinite impulse responsefiltering or exponential moving averaging.

One or more embodiments may comprise post-processing (e.g., 104, 105)the output signal from the neural network processing by at least one of:

-   -   temporal filtering (e.g., 104) to remove mis-classification        errors, and/or    -   heuristic filtering (e.g., 105) to correct systematic prediction        errors and/or to correct transition between classification        classes.

In one or more embodiments, a system (e.g., 100) may comprise an(artificial) neural network circuit (e.g., 103) having first (e.g.,103A), second (e.g., 103B) and third (e.g., 103C) neural network circuitblocks, wherein:

-   -   the first neural network circuit block comprises a first        convolutional layer, wherein two-valued weights are applied to        the input signal, and a two-valued circuit to produce a        two-valued signal from the result of the first convolutional        layer,    -   the second neural network circuit block comprises a further        convolutional layer active on the signal from the first neural        network processing with two-valued weights and (two-valued)        activations, and    -   the third neural network circuit block comprises a fully        connected layer, wherein two-valued weights are applied to the        signal from the second neural network circuit block, a        respective two-valued circuit to produce a two-valued signal        from the result of the fully connected layer (1035), and a        classifier to produce an output signal (OS) from the two-valued        signal from the respective two-valued function,

wherein the first, second and third neural network circuit blocks areconfigured to operate with the method of one or more embodiments.

One or more embodiments may comprise pre-processing circuitry of theinput signal (e.g., x>>>>AS) applied to said neural network circuit, thepre-processing circuitry comprising at least one of:

-   -   a filter (e.g., 101) to separate a dynamic acceleration        component from gravity, and/or    -   a gravity rotator (e.g., 102).

One or more embodiments may comprise post-processing circuits (e.g.,104, 105) of the output signal (OS) from the neural network circuit, thepost-processing circuitry comprising at least one of:

-   -   a temporal filter (e.g., 104) to remove mis-classification        errors, and/or    -   a heuristic filter (e.g., 105) to correct systematic prediction        errors and/or to correct transition between classification        classes.

One or more embodiments may comprise both the temporal filter and theheuristic filter with the heuristic filter downstream of the temporalfilter.

One or more embodiments may comprise:

-   -   at least one sensor (e.g., A, G) providing said input signal,        and    -   a processing pipeline (e.g., 100) implementing said neural        network circuit having first, second and third neural network        circuit blocks.

In one or more embodiments, the at least one sensor and the processingpipeline may be integrated in a single chip (e.g., CP).

In one or more embodiments, the at least one sensor and the processingpipeline may be integrated in distinct chips (e.g., CP1, CP2).

In one or more embodiments, the at least one sensor may comprise one of:

-   -   an accelerometer, or    -   the combination of an accelerometer and a gyroscope.

One or more embodiments may comprise a computer program product loadablein the memory (e.g., 304, 308, 312) of at least one processing circuit(e.g., 300, 302) and comprising software code portions for executing thesteps of the method of one or more embodiments when the product is runon at least one processing circuit.

Without prejudice to the underlying principles, the details andembodiments may vary, even significantly, with respect to what has beendescribed by way of example only, without departing from the extent ofprotection.

Some embodiments may take the form of or include computer programproducts. For example, according to one embodiment there is provided acomputer readable medium including a computer program adapted to performone or more of the methods or functions described above. The medium maybe a physical storage medium such as for example a Read Only Memory(ROM) chip, or a disk such as a Digital Versatile Disk (DVD-ROM),Compact Disk (CD-ROM), a hard disk, a memory, a network, or a portablemedia article to be read by an appropriate drive or via an appropriateconnection, including as encoded in one or more barcodes or otherrelated codes stored on one or more such computer-readable mediums andbeing readable by an appropriate reader device.

Furthermore, in some embodiments, some of the systems and/or modulesand/or circuits and/or blocks may be implemented or provided in othermanners, such as at least partially in firmware and/or hardware,including, but not limited to, one or more application-specificintegrated circuits (ASICs), digital signal processors, discretecircuitry, logic gates, standard integrated circuits, state machines,look-up tables, controllers (e.g., by executing appropriateinstructions, and including microcontrollers and/or embeddedcontrollers), field-programmable gate arrays (FPGAs), complexprogrammable logic devices (CPLDs), etc., as well as devices that employRFID technology, and various combinations thereof.

The various embodiments described above can be combined to providefurther embodiments. Aspects of the embodiments can be modified, ifnecessary to employ concepts of the various patents, applications andpublications to provide yet further embodiments.

These and other changes can be made to the embodiments in light of theabove-detailed description. In general, in the following claims, theterms used should not be construed to limit the claims to the specificembodiments disclosed in the specification and the claims, but should beconstrued to include all possible embodiments along with the full scopeof equivalents to which such claims are entitled. Accordingly, theclaims are not limited by the disclosure.

1. A method, comprising: applying, in a first convolutional layer of aneural network, two-valued weights of the first convolutional layer toan input signal of the first convolutional layer; applying, in a firsttwo-valued function layer of the neural network coupled at input to anoutput of the first convolutional layer, a two-valued function of thefirst two-valued function layer; applying, in a second convolutionallayer of the neural network coupled at input to an output of the firsttwo-valued functional layer, weights of the second convolutional layer;applying, in a fully-connected layer of the neural network coupled atinput to an output of the second convolutional layer, two-valued weightsof the fully connected layer; applying, in a second two-valued functionlayer of the neural network coupled at input to an output of the fullyconnected layer, a two-valued function of the second two-valued functionlayer; and classifying, using a classifier of the neural network coupledat input to an output of the second two-valued function layer, the inputsignal based on an output signal of second two-valued function layer. 2.The method of claim 1, comprising: applying, using a normalization layerof the neural network coupled between the first convolutional layer andthe first two-valued function layer, normalization to an output signalof the first convolutional layer.
 3. The method of claim 1, comprising:applying, using a normalization layer of the neural network coupledbetween the fully-connected layer and the second two-valued functionlayer, normalization to an output signal of the fully-connected layer.4. The method of claim 1, wherein the applying two-valued weights in thefirst convolutional layer comprises applying a set of filters to theinput signal, generating respective filtered output signals.
 5. Themethod of claim 1, wherein the applying weights in the secondconvolutional layer comprises applying a set of filters to the signalfrom the first neural network processing and the method comprises, inthe second convolutional layer, adding together outputs from the filtersin the set of filters, generating respective single values.
 6. Themethod of claim 1, comprising: applying, using a max pooling layercoupled between the second convolutional layer and the fully-connectedlayer, max pooling to an output of the second convolutional layer. 7.The method of claim 1, wherein the classifying comprises applyingsoftmax classification.
 8. The method of claim 1, comprising: applyingpre-neural network processing to an acceleration signal, generating theinput signal of the first convolutional layer, the pre-neural networkprocessing including filtering to separate a dynamic accelerationcomponent from a gravity component of the acceleration signal.
 9. Themethod of claim 8, wherein the filtering to separate the dynamicacceleration component from the gravity component comprises one ofinfinite impulse response filtering or exponential moving averaging. 10.The method of claim 8 wherein the pre-neural network processingincludes: applying a gravitational rotation to the filtered accelerationsignal.
 11. The method of claim 1, comprising: applying post-neuralnetwork processing to an output of the classifier, the post-neuralnetwork processing including at least one of: temporal filtering toremove mis-classification errors; and heuristic filtering.
 12. Themethod of claim 1 wherein the weights of the second convolutional layerare two-valued weights.
 13. A device, comprising: a first convolutionallayer of a neural network, which, in operation, applies two-valuedweights of the first convolutional layer; a first two-valued functionlayer of the neural network coupled at input to an output of the firstconvolutional layer, wherein the first two-valued function layer, inoperation, applies a two-valued function of the first two-valuedfunction layer; a second convolutional layer of the neural networkcoupled at input to an output of the first two-valued functional layer,wherein the second convolutional layer in operation, applies weights ofthe second convolutional layer; a fully-connected layer of the neuralnetwork coupled at input to an output of the second convolutional layer,wherein the fully connected layer, in operation, applies two-valuedweights of the fully connected layer; a second two-valued function layerof the neural network coupled at input to an output of the fullyconnected layer, wherein the second two-valued function layer, inoperation, applies a two-valued function of the second two-valuedfunction layer; and a classifier of the neural network coupled at inputto an output of the second two-valued function layer, wherein theclassifier, in operation, classifies an input signal to the firstconvolutional layer based on an output signal of second two-valuedfunction layer.
 14. The device of claim 13, comprising: a normalizationlayer of the neural network coupled between the first convolutionallayer and the first two-valued function layer, wherein the normalizationlayer, in operation, normalizes an output signal of the firstconvolutional layer.
 15. The device of claim 14, comprising: a secondnormalization layer of the neural network coupled between thefully-connected layer and the second two-valued function layer, whereinthe second normalization layer, in operation, normalizes an outputsignal of the fully-connected layer.
 16. The device of claim 13 whereinthe first convolutional layer comprises a set of filters, which, inoperation, generate respective filtered signals.
 17. The device of claim13 wherein the second convolutional layer comprises a set of filterscoupled to an adder.
 18. The device of claim 13, comprising: a maxpooling layer coupled between the second convolutional layer and thefully-connected layer.
 19. A system, comprising: an input; and digitalsignal processing circuitry, coupled to the input, wherein the digitalsignal processing circuitry, in operation, implements a neural networkcomprising: a first convolutional layer which, in operation, appliestwo-valued weights to the input signal; a first two-valued functionlayer, which, in operation, applies a first two-valued function to anoutput of the first convolutional layer; a second convolutional layer,which, in operation, applies weights to an output of the firsttwo-valued function layer; a fully-connected layer coupled to the secondconvolutional layer, which, in operation, applies two-valued weights toan input of the fully connected layer; a second two-valued functionlayer, which, in operation, applies a two-valued function to an outputof the fully connected layer; and a classifier, which, in operation,classifies a signal received by the input based on an output signal ofsecond two-valued function layer.
 20. The system of claim 19 wherein thedigital signal processing circuitry, in operation: normalizes the outputof the first convolutional layer provided to the first two-valuedfunction layer; adds components of an output of the second convolutionallayer, generating the input to the fully-connected layer; and normalizesthe output of the fully-connected layer provided to the secondtwo-valued function layer.
 21. The system of claim 19, comprising:pre-neural network processing circuitry coupled to the input, thepre-neural network processing circuitry including a filter and agravitational rotator.
 22. The system of claim 19, comprising:post-neural network processing circuitry coupled to the input, thepost-neural network processing circuitry including a temporal filter anda heuristic filter.
 23. The system of claim 19, comprising: anaccelerometer.
 24. The system of claim 23, comprising: a gyroscope. 25.The system of claim 23, comprising a chip including the digital signalprocessing circuitry and the accelerometer.
 26. A non-transitorycomputer-readable medium having contents which configure digital signalprocessing circuitry to implement a neural network, the neural networkcomprising: a first convolutional layer which, in operation, appliestwo-valued weights to an input signal; a first two-valued function layercoupled at input to an output of the first convolutional layer, andwhich, in operation, applies a first two-valued function; a secondconvolutional layer coupled at input to an output of the firsttwo-valued function layer, and which, in operation, applies weights; afully-connected layer coupled at input to an output of the secondconvolutional layer, and which, in operation, applies two-valuedweights; a second two-valued function layer coupled at input to anoutput of the fully connected layer, and which, in operation, applies atwo-valued function; and a classifier, which, in operation, classifiesthe input signal based on an output of second two-valued function layer.27. The non-transitory computer-readable medium of claim 26 wherein thecontents comprises instructions executed by the digital signalprocessing circuitry.
 28. The non-transitory computer-readable medium ofclaim 27 wherein the instructions, when executed by the digital signalprocessing circuitry, cause the digital signal processing circuitry tofilter the input signal provided to the first convolutional layer.